<?php
	include "userfunctions.php";
	startsql();
	$userip = $_SERVER["REMOTE_ADDR"];
	$aid = $_GET['aid'];
	if(isset ($aid) and isset ($_GET['vote'])) {
		//check that there is not already a vote...
		$result = add_new_vote($userip,$_GET['aid'],$_GET['vote']);
		$value = get_rating($aid);
		if($value === false) {
			echo "PROBLEM";
		} else { echo $value; }
	}
